/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package technotheist.data;

/**
 *
 * @author Mitch
 * @param <N>
 */
public class BScalar<N extends Number> implements BObj {

    private final BBuffer<N> buffer;
    private final int index;

    public BScalar(BBuffer<N> buffer, int index) {
	this.buffer = buffer;
	this.index = index;
    }

    public N s() {
	return buffer.s(index);
    }

    public void s(N val) {
	buffer.s(index, val);
    }

    public static class BInt extends BScalar<Integer> {

	public BInt(BBuffer<Integer> buffer, int index) {
	    super(buffer, index);
	}

    }

    public static class BFloat extends BScalar<Float> {

	public BFloat(BBuffer<Float> buffer, int index) {
	    super(buffer, index);
	}
    }

    public static class BByte extends BScalar<Byte> {

	public BByte(BBuffer<Byte> buffer, int index) {
	    super(buffer, index);
	}
    }
}
